
<%@page contentType="text/html;charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="tiles" uri="http://tiles.apache.org/tags-tiles"%>

<c:url var="urlIncluir" value="/pessoa/manter-contratos" />
<c:url var="urlLimpar"
	value="/pessoa/incluir-contrato/${contrato.pessoa.id}" />

<!-- Begin page content -->
<div class="container">
	<div class="page-header">
		<h3>Contratos - ${contrato.pessoa.nome}</h3>
	</div>
	<div class="alert alert-danger" id="painelErro">
		<span><strong>Erro:</strong><span id="mensagemErro"></span> </span>
	</div>
	<form:form method="GET" role="form" action="${urlLimpar}"
		id="formulario-limpar" />
	<form:form method="POST" class="form-horizontal" role="form"
		action="${urlIncluir}" modelAttribute="contrato" id="formulario">
		<form:hidden path="pessoa.id" />
		<form:hidden path="id" />


		<div class="form-group">
			<div class="form-group">
				<label for="inputMatricula" class="col-lg-1 control-label">Matrícula</label>
				<div class="col-lg-2">
					<form:input type="text" class="form-control" id="inputMatricula"
						placeholder="Digite a matrícula" path="matricula" />
				</div>
			</div>
			<div class="form-group">
				<label for="inputNivel" class="col-lg-1 control-label">Nível</label>
				<div class="col-lg-3">
					<form:select id="inputNivel" path="nivel.id" class="form-control">
						<form:option value="">Selecione</form:option>
						<form:options items="${niveis}" itemLabel="descricao"
							itemValue="id" />
					</form:select>
				</div>
			</div>
			<div class="form-group">
				<label for="inputSecretaria" class="col-lg-1 control-label">Secretaria</label>
				<div class="col-lg-3">
					<form:select id="inputSecretaria" path="secretaria.id"
						class="form-control">
						<form:option value="">Selecione</form:option>
						<form:options items="${secretarias}" itemLabel="descricao"
							itemValue="id" />
					</form:select>
				</div>
			</div>
			<div class="form-group">
				<label for="inputDepartamento" class="col-lg-1 control-label">Departamento</label>
				<div class="col-lg-3">
					<form:select id="inputDepartamento" path="departamento.id"
						class="form-control">
						<form:option value="">Selecione</form:option>
						<form:options items="${departamentos}" itemLabel="descricao"
							itemValue="id" />
					</form:select>
				</div>
			</div>
			<div class="form-group">
				<label for="inputDataInicio" class="col-lg-1 control-label">Data
					Início</label>
				<div class="col-lg-2">
					<form:input type="text" id="inputDataInicio" path="dataInicio"
						class="form-control" placeholder="Digite a data de início" />
				</div>
			</div>
			<div class="form-group">
				<label for="inputDataFim" class="col-lg-1 control-label">Data
					Afastamento</label>
				<div class="col-lg-2">
					<form:input type="text" id="inputDataFim" path="dataFim"
						class="form-control" placeholder="Digite a data de afastamento" />
				</div>
			</div>

		</div>

		<div class="form-group">
			<label for="inputBanco" class="col-lg-1 control-label">Banco</label>
			<div class="col-lg-3">
				<form:select id="inputBanco" path="banco" class="form-control">
					<option>Selecione</option>
					<c:forEach var="banco" items="${bancos}">
						<option value="${banco}"
							<c:if test="${banco.descricao eq contrato.banco.descricao}" > selected="selected" </c:if>>
							${banco.descricao}</option>
					</c:forEach>
				</form:select>
			</div>
			<label for="inputAgencia" class="col-lg-1 control-label">Agência</label>
			<div class="col-lg-2">
				<form:input type="text" id="inputAgencia" path="agencia"
					class="form-control" placeholder="Digite a agência" />
			</div>
			<label for="inputContaCorrente" class="col-lg-1 control-label">Conta</label>
			<div class="col-lg-2">
				<form:input type="text" id="inputContaCorrente" path="conta"
					class="form-control" placeholder="Digite a conta corrente" />
			</div>

		</div>


		<div class="form-group">
			<label class="col-lg-1 control-label"></label>
			<div class="col-lg-6">
				<a href="#" id="btn-incluir" class="btn btn-primary">Adicionar</a>&nbsp;
				<a href="#" id="btn-limpar" class="btn btn-success">Limpar</a>
			</div>
		</div>


	</form:form>
	<div id="divList">
		<tiles:insertAttribute name="list" />
	</div>
</div>
